# -*- coding: utf-8 -*-
import yaml

# ────────────────────────────
# 环境配置
# ────────────────────────────
class Config:
    """读取 config.yml 配置文件"""

    def __init__(self, file_path: str = "config.yml") -> None:
        # 读取 YAML 文件
        with open(file_path, 'r', encoding='utf-8') as file:
            config = yaml.safe_load(file)

        # 直接访问二维数组
        self.stock_list = config['stock_list']
        self.mysql = config["mysql"]

    def __repr__(self) -> str:
        """返回配置的字符串表示"""
        return self.__str__()

    def __str__(self) -> str:
        """返回配置的字符串表示"""
        return f"========== 配置信息 ==========\nmysql: {self.mysql}\nstock_list: {self.stock_list}\n============================== "
